package com.googlecode.openauth.web.action;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

import java.util.List;

import org.apache.ibatis.session.RowBounds;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.googlecode.openauth.web.dao.IResourceDao;
import com.googlecode.openauth.web.entity.ResourceInfo;
import com.googlecode.openauth.web.entity.UserInfo;

public class ResourceActionTest {

	private static ApplicationContext context;

	private static IResourceDao resourceDao = null;
	
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		context = new ClassPathXmlApplicationContext("applicationContext.xml");
		resourceDao = (IResourceDao) context.getBean("resourceDao");
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testList() {
		UserInfo userInfo = new UserInfo();
		userInfo.setUserId(2);
		RowBounds rowBounds = new RowBounds(0,1);
		List<ResourceInfo> list = resourceDao.getAllResources(userInfo, rowBounds);
		assertEquals(2, list.size());
	}

	@Test
	public void testGetFirstPage() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetPrevPage() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetNextPage() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetLastPage() {
		fail("Not yet implemented");
	}

	@Test
	public void testSave() {
		fail("Not yet implemented");
	}

	@Test
	public void testInit() {
		fail("Not yet implemented");
	}

	@Test
	public void testDelete() {
		fail("Not yet implemented");
	}

}
